from django.contrib.auth.models import UserManager


class SiteUserManager(UserManager):
    def create_user(self, username, email=None, password=None, nickname=None, **extra_fields):
        if nickname is None:
            raise ValueError("用户需要昵称数据~")
        super().create_user(username, password, nickname=nickname, **extra_fields)

    def create_superuser(self, username, email=None, password=None, nickname=None, **extra_fields):
        ...